package servidor;

import java.io.PrintStream;
import org.omg.CORBA.ORB;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import org.omg.PortableServer.*;
import sop_corba.ParserRHelper;

// Referenced classes of package servidor:
//            ParserRImpl

public class ServidorP
{

    public ServidorP()
    {
    }

    public static void main(String args[])
    {
        try
        {
            ORB orb = ORB.init(args, ((java.util.Properties) (null)));
            POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            poa.the_POAManager().activate();
            ServidorPImpl parserrimpl = new ServidorPImpl();
            org.omg.CORBA.Object obj = poa.servant_to_reference(parserrimpl);
            sop_corba.ParserR parserr = ParserRHelper.narrow(obj);
            org.omg.CORBA.Object obj1 = orb.resolve_initial_references("NameService");
            NamingContextExt namingcontextext = NamingContextExtHelper.narrow(obj1);
            String s = "parserR";
            org.omg.CosNaming.NameComponent anamecomponent[] = namingcontextext.to_name(s);
            namingcontextext.rebind(anamecomponent, parserr);
            System.out.println("El ServidorP esta listo y esperando ...");
            orb.run();
        }
        catch(Exception exception)
        {
            System.err.println((new StringBuilder()).append("ERROR: ").append(exception).toString());
            exception.printStackTrace(System.out);
        }
        System.out.println("ServidorP: Saliendo ...");
    }
}